package com.itheima.homework;

import com.itheima.homework.domain.Person;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Properties_Reflect {
    public static void main(String[] args) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
        Properties properties = new Properties();
        properties.load(ClassLoader.getSystemClassLoader().getResourceAsStream("method.properties"));
        System.out.println(properties.getProperty("className"));
        System.out.println(properties.getProperty("methodName"));
        Class clazz = Class.forName(properties.getProperty("className"));
        //Method methodName = clazz.getDeclaredMethod(properties.getProperty("methodName"),properties.getProperty("arg1"));
        Method methodName = clazz.getDeclaredMethod(properties.getProperty("methodName"), properties.getProperty("arg1").getClass());
        methodName.setAccessible(true);
        methodName.invoke(clazz.newInstance(),"奥利给");
    }
}
